using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMM.Core.Domain;
using ServiceStack.ServiceHost;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using MMM.Services.Base;
using MMM.Services.Operations;
using MMM.Services.Type;

namespace MMM.Services
{

    public class RoleService : BaseService<Role>
    {
    }

    public class RoleGetSerice : BaseGetService<RolePageGet, Role>
    {
        protected override string CreateFilter(RolePageGet request)
        {

            string sql = "";
            IList<Filter> lst = request.GetFilter();
            if (lst == null)
            {
                return string.Empty;
            }
            foreach (var item in lst)
            {
                if (item.Property == "ddddd")
                {
                    //if (string.IsNullOrEmpty(sql))
                    //{
                    //    sql = item.ToSqlLessThanAndAEque();
                    //}
                    //else
                    //{
                    //    sql = string.Format("{0} and {1}", sql, item.ToSqlLessThanAndAEque());
                    //}
                }
                else
                {
                    if (string.IsNullOrEmpty(sql))
                    {
                        sql = item.ToSqlLike();
                    }
                    else
                    {
                        sql = string.Format("{0} and {1}", sql, item.ToSqlLike());
                    }
                }
            }
            return sql;

        }
        
    }

}
